<?php

/**
 * EVENTS filter form base class.
 *
 * @package    campus-plateform
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseEVENTSFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'title'                => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'start_date'           => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'end_date'             => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'start_hours'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'end_hours'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'description'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'member_price'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'no_member_price'      => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'city'                 => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'zip_code'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'address'              => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'deadline_inscription' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'deadline_payment'     => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'visibility_date'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'email_body'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'email_date'           => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'reminder_email'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'cost'                 => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'ALBUMS_id'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ALBUMS'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'title'                => new sfValidatorPass(array('required' => false)),
      'start_date'           => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'end_date'             => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'start_hours'          => new sfValidatorPass(array('required' => false)),
      'end_hours'            => new sfValidatorPass(array('required' => false)),
      'description'          => new sfValidatorPass(array('required' => false)),
      'member_price'         => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'no_member_price'      => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'city'                 => new sfValidatorPass(array('required' => false)),
      'zip_code'             => new sfValidatorPass(array('required' => false)),
      'address'              => new sfValidatorPass(array('required' => false)),
      'deadline_inscription' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'deadline_payment'     => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'visibility_date'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'email_body'           => new sfValidatorPass(array('required' => false)),
      'email_date'           => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'reminder_email'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'cost'                 => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'ALBUMS_id'            => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('ALBUMS'), 'column' => 'id')),
    ));

    $this->widgetSchema->setNameFormat('events_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'EVENTS';
  }

  public function getFields()
  {
    return array(
      'id'                   => 'Number',
      'title'                => 'Text',
      'start_date'           => 'Date',
      'end_date'             => 'Date',
      'start_hours'          => 'Text',
      'end_hours'            => 'Text',
      'description'          => 'Text',
      'member_price'         => 'Number',
      'no_member_price'      => 'Number',
      'city'                 => 'Text',
      'zip_code'             => 'Text',
      'address'              => 'Text',
      'deadline_inscription' => 'Date',
      'deadline_payment'     => 'Date',
      'visibility_date'      => 'Date',
      'email_body'           => 'Text',
      'email_date'           => 'Date',
      'reminder_email'       => 'Date',
      'cost'                 => 'Number',
      'ALBUMS_id'            => 'ForeignKey',
    );
  }
}
